﻿function submittextarea(textareaValue){
	var Letters = "1234567890?？"; //可以自己增加可输入值



	var textareaType = textareaValue.split(",");//值用逗号隔开
	var i;
	var c;

	for(i = 0; i< textareaType.length; i++){
		c = textareaType[i].charAt(i);

		if(textareaValue==""){
			alert("对不起.离散号码不能为空.")
			return false;
		}

		if (Letters.indexOf( c ) < 0){//验证是否是数字



			alert("对不起.离散号码只能输入数字.")
			return false;
		}

		if (textareaType[i].charAt(0) != '1' || (textareaType[i].charAt(1) != '3' && textareaType[i].charAt(1) != '5' && textareaType[i].charAt(1) != '8')){//判断前两位是否是1和3
			alert("对不起.你输入的离散号码格式不正确.")
			return false;
		}

		if(textareaType[i].length != 11){//判断以逗号隔开的每组号码是否是11位



			alert("对不起.请确定离散号码的每组号码是否为11位.")
			return false;
		}

		if(( textareaType[i].charAt( textareaType[i].length - 5 ) == '?') || (textareaType[i].charAt( textareaType[i].length - 5 ) == '？') || ( textareaType[i].charAt( textareaType[i].length - 6 ) == '?') || (textareaType[i].charAt( textareaType[i].length - 6 ) == '？') || ( textareaType[i].charAt( textareaType[i].length - 7 ) == '?') || (textareaType[i].charAt( textareaType[i].length - 7 ) == '？') || ( textareaType[i].charAt( textareaType[i].length - 8 ) == '?') || (textareaType[i].charAt( textareaType[i].length - 8 ) == '？') || ( textareaType[i].charAt( textareaType[i].length - 9 ) == '?') || (textareaType[i].charAt( textareaType[i].length - 9 ) == '？')){//判断支持最后四个问号



			alert("对不起.离散号码的每组号码只支持最后四位问号.");
			return false;
		}
	}
	return true;
}
function disk(field){//判断是否是有效的路径

if( ((field.charAt(0) >= "a") && (field.charAt(0) <= "z")) || ((field.charAt(0) >= "A") && (field.charAt(0) <= "Z")) ){
}else{
alert("对不起.盘符必须是英文字母.");
return false;
}

var fso = new ActiveXObject("Scripting.FileSystemObject");
var i = field.charAt(0);
//var a = i.toUpperCase();
hasDrive = fso.DriveExists(i); //检查系统是否存在此盘



if(hasDrive){
	}else{
		alert("你的系统内没有"+i+"盘");
        return false;
	}

if(field.charAt(1)!=":" || field.charAt(2)!="\\"){
	alert("对不起.您的路径输入格式不正确.");
    return false;
}
return true;
}

function checkFileType(str1){ //判断是否是有效的后缀名



var fileType = (str1.substring(str1.lastIndexOf("."),str1.length)).toLowerCase()

	if(fileType != ".txt" && fileType != ".xls"){
				return false;
			}
			return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
function issame(str1,str2)  //判断密码是否输入一致



{
if (str1==str2)
{return(true);}
else
{return(false);}
}


//////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkIP(IPCheck)   //判断IP地址是否正确
{
	var re = /^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$/gi;
	var temp = re.exec(IPCheck);
	if(temp)
	{
			var num = IPCheck.split(".");
			if(num[0]<255&&num[1]<255&&num[2]<255&&num[3]<255)
			{
				 return true;
			}
			else
			{
				return false;
			}
	}
	else
	{
		return false;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
function isurl(strurl) {//判断是否是有效的URL连接
   if (strurl.charAt(0)=="h" && strurl.charAt(1)=="t" && strurl.charAt(2)=="t" && strurl.charAt(3)=="p" && strurl.charAt(4)==":" && strurl.charAt(5)=="/" && strurl.charAt(6)=="/" && strurl.charAt(7)!=""){
   return true;
  }else{
   }
}
//////////////////////////////////////////////////////////////////////////////////////////////////
function url(strurl) {//判断是否是有效的URL连接
   if (strurl.search(/^\w+((-\w+)|(\:\/\/\w+))*\w[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
   return true;
  }else{
   }
}

//////////////////////////////////////////////////////////////////////////////////////////////////
function isValidate(field)//是否是字母



{


	var i;

	for (i = 0; i < field.length; i++)
	{
		var c = field.substr(i,1);

		if (! (isLetter(c) || isDigit(c) ) )
		{
			return false;
		}
	}

	return true;
}

/////////////////////////////////////////////////////////////////////////////////////////////////

function isLetterString(field)//是否是字母



{
	field = myTrim(field);

	var i;

	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if (! isLetter(c) )
		{
			return false;
		}
	}

	return true;
}

//////////////////////////////////////////////////////////////////////////////////////////////////
function isRunNian(s){//是否是闰年



	//alert(s%4);
	if(s%4!=0){
		return false;
	}else{
		if(s%100!=0){
			return true;
		}else{
			if(s%400==0){
				return true;
			}else{
				return false;
			}
		}
	}
}


//////////////////////////////////////////////////////////////////////////////////////////////////


 function getLastDay(year,month){//取当前月最后一天



	var s = new Array("01","03","05","07","08","10","12");
	var s1=new Array("04","06","09","11");

	for(i=0;i< s.length;i++){
		if(month==s[i]){
			return "31";
		}
	}

	for(i=0;i<s1.length;i++){
		if(month==s1[i]){
			return "30";
		}
	}

	if(isRunNian(year)){
		return "29";
	}else{
		return "28";
	}

}


//////////////////////////////////////////////////////////////////////////////////////////////////
function isNumbers(field)//是否是数字



{
	field = myTrim(field);
	var i;

	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if (!isDigit(c) )
		{
			return false;
		}
	}

	return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////

function radio_active(radio_group)//获取当前被选中的单选按钮



{
	for(counter = 0 ; counter < radio_group.length ; counter++)
	{
		if(radio_group[counter].checked)
		{
			return counter;
		}
	}

	return -1;
}

/////////////////////////////////////////////////////////////////////////////////////////////////

function isEmpty(field)//是否为空
{
	field = trimEnter(field);
	return ((field == null) || (field.length == 0) || myTrim(field)=="");
}


function trimEnter(input)
{
	var tmp = "";

	for (var begin=0;begin <input.length;begin++)
	{
		var chrCode = input.charCodeAt(begin);
		if((chrCode!=13)&&(chrCode!=10))
		tmp+=input.charAt(begin);

	}
	return tmp;
}

//////////////////////////////////////////////////////////////////////////////////////////////////

function isInteger(field)//输入整数
{
	s = myTrim(field);

	var i;

	if (isEmpty(field))
	{
		return false;
	}

	for (i=0; i<field.length; i++)
	{
		var c = field.charAt(i);

		if (!isDigit(c))
		{
			return false;
		}

		if(c==0&&i==0&&field.length>1)
		{
			return false;
		}
	}

	return true;
}

///////////////////////////////////////////////////////////////////////////////////////

function isLetter(c)//判断单个字符是否是英文字符



{
	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) );
}

///////////////////////////////////////////////////////////////////////////////////////

function isDigit(c)//是否是数字（单个字符）



{
	return ((c >= "0") && (c <= "9"));
}

///////////////////////////////////////////////////////////////////////////////////////
function myTrim(str)//去掉字符串空格



{
	var end = false;
	var ch;

	while(!end)
	{
		if (str.length == "0") break;
		ch = str.charAt(0);

		if (ch == ' ')
		{
			str = str.substring(1,str.length);
		}
		else
		{
			end = true;
		}
	}

	end = false;

	while(!end)
	{
		if (str.length == 0)
		{
			break;
		}

		ch = str.charAt(str.length-1);

		if (ch == ' ')
		{
			str = str.substring(0,str.length-1);
		}
		else
		{
			end = true;
		}
	}

	return str;
}


////////////////////////////////////////////////////////////////////////////////////////////


function myReset(w, h)
{
	var pox = (screen.width-w)/2;
	var poy = (screen.height-h)/2;
	window.resizeTo(w+15, h+10);
	window.moveTo(((pox>0&&pox<screen.width)?pox:0), ((poy>0&&poy<screen.height)?poy:0));
}

//////////////////////////////////////////////////////////////////////////////////////

function isPrice(field)//验证带小数点的值



{
	field = myTrim(field);
	var i;
	var seenDecimalPoint = false;

	if (isEmpty(field))
	{
		return false;
	}

	if (field == ".")
	{
		return false;
	}

	for (i=0; i<field.length; i++)
	{
		// Check that current character is number.
		var c = field.charAt(i);

		if ((c == ".") && !seenDecimalPoint)
		{
			seenDecimalPoint = true;
		}
		else if (!isDigit(c))
		{
			return false;
		}
	}
	if(seenDecimalPoint == true)
	{
	  var afterdot = field.substring(field.indexOf('.',0)+1).length;

	  if(afterdot > 2)
	  {
		 return false;
	  }
    }
	return true;
}
////////////////////////////////////////////////////////////////////////////////////


function calculatebytesize(field)
{
	field = myTrim(field);

	var i;
	var size=0;

	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if ((c >= "!") && (c <= "\u20AC")||(c==" ") )
		{
			size=size+1;
		}
		else
		{
			size=size+3;
		}
	}

	return size;
}


////////////////////////////////////////////////////////////////////////////////////////

function setLetterBorder(toneNameLetter)
{
	var imgName = "img" + toneNameLetter.toLowerCase();
	document.images[imgName].border = 2;

}

//////////////////////////////////////////////////////////////////////////////////////////////
function setSelectValue(selectstart, value1, selectend, value2)//获得当前下拉列表筐被选种项的值



{
	if(selectstart.value == value1)
	{
		selectend.value = value2;
		selectend.disabled = true;
	}
	else
	{
		selectend.disabled = false;
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////
function checkHandPhones(phone , countrytype)//是否是电话号码



{
	if(isNaN(phone))
	{
		return 1;
	}


	if(countrytype == 1)
	{
		if(phone.length != 8)
		{
			return 2;
		}
		else if(phone.charAt(0) != '0')
		{
			return 3;
		}
		else
		{
			return 0;
		}
	}
	else
	{
		if(phone.length != 11)
		{
			return 2;
		}
		else if(phone.charAt(0) != '1' || (phone.charAt(1) != '3' && phone.charAt(1) != '5' && phone.charAt(1) != '8'))
		{
			return 3;
		}
		else
		{
			return 0;
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////

function isnumber(mobile) //客服对手机号码的判断
{
    var tolnumber = "0123456789";
    var subnumber;
    var subtolnumber;
    for(var i = 0;i < mobile.length; i++)
    {
        subnumber = mobile.substring(i,1);
        var isnumber = true;
        for(var j = 0; j < tolnumber.length; j++)
        {
            subtolnumber = tolnumber.substring(j,1);
            if(subnumber == subtolnumber)
            {
                isnumber = false;
            }
        }
        if(isnumber)
        {
            return true;
        }
    }
    return true;
}

function formatCheckout(mobile)
{
    var charsubstr1 = mobile.substring(0,2);
    if(charsubstr1 != "13" || charsubstr1 != "15" || charsubstr1 != "18")
    {
        return true;
    }
}

//////////////////////////////////////////////////////////////////////////////////////////////////
function isNumbertwo(str)//判断是否是数字



{
var Letters = "+1234567890"; //可以自己增加可输入值



var i;
var c;
if(str.length < 11)
return false;
var substr = str.charAt(0);
if(substr != '+')
{
    var numstr = str.substring(0,2);
    if(numstr != '13' || numstr != '15' ||  numstr != '18')
    {
        return false;
    }
}
else
{
    var subnumstr = str.substring(3,2);
    if(subnumstr != '13' || subnumstr != '15' ||  subnumstr != '18')
    {
        return false;
    }
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////

function checkFixedPhone(phone)
{
	if(isNaN(phone))
	{
		return 1;
	}
	else if(phone.length == 0)
	{
		return 2;
	}
	else if (phone.length > 15)
	{
		return 3;
	}

	else if(phone.charAt(0) != '0')
	{
		return 4;
	}
	else if(	phone.length <10)
	{
		return 5;
	}
	else
	{
		return 0;
	}
}


///////////////////////////////////////////////////////////////////////////////////////////////

function convertDBFormat(dbField)
{
	var returnStr = "";
	var fieldArray = dbField.split("'");

	for(var i = 0; i < fieldArray.length; i++)
	{
		if(i == fieldArray.length - 1)
		{
			returnStr = returnStr + fieldArray[i];
		}
		else
		{
			returnStr = returnStr + fieldArray[i] + "''";
		}
	}

	return returnStr;
}

//////////////////////////////////////////////////////////////////////////////////////////////////
function play(field)
{
	document.all.bgsound.src=field;
}

//////////////////////////////////////////////////////////////////////////////////////////////////


function round_decimals(original_number , decimals)
{
	var result1 = original_number * Math.pow(10 , decimals);
	var result2 = Math.round(result1);
	var result3 = result2 / Math.pow(10 , decimals);

	return(result3);
}

//////////////////////////////////////////////////////////////////////////////////////////////////

/*modify by zhouqiong 20070325 去掉对“_”的屏蔽*/
function containInvalidChar(field)//是否是特殊符号(全)
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c=='◎' || c=='※' || c=='～' || c=='！' || c=='·' || c=='＃' || c=='￥' || c=='＊' || c=='……' || c=='—' || c=='（' || c=='）' || c=='＋' || c=='｜' || c=='｝' || c=='｛'
|| c=='”' || c=='“'|| c=='：' || c=='？' || c=='》' || c=='《' || c=='～' || c=='！' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆' || c=='＊' || c=='（' || c=='）'
|| c=='＋' || c=='｜' || c=='｝' || c=='｛' || c=='＂' || c=='：' || c=='？' || c=='＞' || c=='＜' || c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&'
|| c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='}' || c=='{' || c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='~' || c=='！' || c=='·' || c=='#' || c=='；' || c=='-' || c=='－' || c=='－' || c=='-' || c=='；'
|| c=='￥' || c=='%' || c=='……' || c=='—' || c=='*' || c=='（' || c=='）' || c=='+' || c=='|' || c=='}' || c=='{' || c=='“' || c=='：' || c=='？' || c=='》' || c=='《' || c=='‘' || c=='＇' || c=='\'' || c=='’' || c=='，' || c==',' || c=='，' || c=='，'
|| c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='？' || c=='}' || c=='{' || c==';' || c=='；' || c=='；' || c=='；'
|| c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='`' || c=='-' || c=='=' || c=='\\' || c==']' || c=='[' || c=='\'' || c==';' || c=='/' || c=='.' || c==',' || c=='”' || c=='＂' || c=='…' || c=='。' || c=='.' || c=='．' || c=='。'
|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='、' || c=='\\' || c=='＼' || c=='、' || c=='｜' || c=='＝' || c=='=' || c=='＋' || c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉' )
		{
			return true;
		}
	}

	return false;
}

/*  add by wangyong 检查SQL模板信息  */
function containInvalidSqlChar(field)//是否是特殊符号(全)
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);
		if(c==' '||c=='◎' || c=='※' || c=='～' || c=='！' || c=='·' || c=='＃' || c=='￥' || c=='＊' || c=='……' || c=='—' || c=='（' || c=='）' || c=='＋' || c=='｜' || c=='｝' || c=='｛'
|| c=='”' || c=='“'|| c=='：' || c=='？' || c=='》' || c=='《' || c=='～' || c=='！' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆' || c=='＊' || c=='（' || c=='）'
|| c=='＋' || c=='｜' || c=='｝' || c=='｛' || c=='＂' || c=='：' || c=='？' || c=='＞' || c=='＜' || c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='^' || c=='&'
|| c=='*' || c=='+' || c=='|' || c=='}' || c=='{' || c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='~' || c=='！' || c=='·' || c=='#' || c=='；' || c=='－' || c=='－' || c=='；'
|| c=='￥'|| c=='……' || c=='—' || c=='*' || c=='（' || c=='）' || c=='+' || c=='|' || c=='}' || c=='{' || c=='“' || c=='：' || c=='？' || c=='》' || c=='《' || c=='‘' || c=='＇' || c=='’' || c=='，'|| c=='，' || c=='，'
|| c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='^' || c=='&' || c=='*' || c=='+' || c=='|' || c=='？' || c=='}' || c=='{' || c==';' || c=='；' || c=='；' || c=='；'
|| c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='`' || c=='=' || c=='\\' || c==']' || c=='['  || c==';' || c=='/' || c=='.' || c=='”' || c=='＂' || c=='…' || c=='。' || c=='.' || c=='．' || c=='。'
|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='、' || c=='\\' || c=='＼' || c=='、' || c=='｜' || c=='＝' || c=='=' || c=='＋' || c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉' )
		{
			return true;
		}
	}

	return false;
}


/*add by zhangxiaowei 检查任务名称，任务名称可用包含空格*/
function containInvalidCharByTaskName(field)//是否是特殊符号(全)
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c=='◎' || c=='※' || c=='～' || c=='！' || c=='·' || c=='＃' || c=='￥' || c=='＊' || c=='……' || c=='—' || c=='（' || c=='）' || c=='＋' || c=='｜' || c=='｝' || c=='｛'
|| c=='”' || c=='“'|| c=='：' || c=='？' || c=='》' || c=='《' || c=='～' || c=='！' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆' || c=='＊' || c=='（' || c=='）'
|| c=='＋' || c=='｜' || c=='｝' || c=='｛' || c=='＂' || c=='：' || c=='？' || c=='＞' || c=='＜' || c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&'
|| c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='}' || c=='{' || c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='~' || c=='！' || c=='·' || c=='#' || c=='；' || c=='-' || c=='－' || c=='－' || c=='-' || c=='；'
|| c=='￥' || c=='%' || c=='……' || c=='—' || c=='*' || c=='（' || c=='）' || c=='+' || c=='|' || c=='}' || c=='{' || c=='“' || c=='：' || c=='？' || c=='》' || c=='《' || c=='‘' || c=='＇' || c=='\'' || c=='’' || c=='，' || c==',' || c=='，' || c=='，'
|| c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='？' || c=='}' || c=='{' || c==';' || c=='；' || c=='；' || c=='；'
|| c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='`' || c=='-' || c=='=' || c=='\\' || c==']' || c=='[' || c=='\'' || c==';' || c=='/' || c=='.' || c==',' || c=='”' || c=='＂' || c=='…' || c=='。' || c=='.' || c=='．' || c=='。'
|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='、' || c=='\\' || c=='＼' || c=='、' || c=='｜' || c=='＝' || c=='=' || c=='＋' || c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉')
		{
			return true;
		}
	}

	return false;
}

function checkgroupname(field)//判断群组名称中的特殊字符
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c=='◎' || c=='※' || c=='～' || c=='！' || c=='·' || c=='＃' || c=='￥' || c=='＊' || c=='……' || c=='（' || c=='）' || c=='——' || c=='＋' || c=='｜' || c=='｝' || c=='｛' || c=='\u00B7'
|| c=='”' || c=='“'|| c=='：' || c=='？' || c=='》' || c=='《' || c=='～' || c=='！' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆' || c=='＊' || c=='（' || c=='）'
|| c=='＋' || c=='｜' || c=='｝' || c=='｛' || c=='＂' || c=='：' || c=='？' || c=='＞' || c=='＜' || c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&'
|| c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='}' || c=='{' || c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='~' || c=='！' || c=='·' || c=='#' || c=='；' || c=='；'
|| c=='￥' || c=='%' || c=='……' || c=='*' || c=='（' || c=='）' || c=='——' || c=='+' || c=='|' || c=='}' || c=='{' || c=='“' || c=='：' || c=='？' || c=='》' || c=='《' || c=='‘' || c=='＇' || c=='\'' || c=='’' || c=='，' || c==',' || c=='，' || c=='，'
|| c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='？' || c=='}' || c=='{' || c==';' || c=='；' || c=='；' || c=='；'
|| c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='`' || c=='=' || c=='\\' || c==']' || c=='[' || c=='\'' || c==';' || c=='/' || c=='.' || c==',' || c=='”' || c=='＂' || c=='…' || c=='。' || c=='.' || c=='．' || c=='。'
|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='、' || c=='\\' || c=='＼' || c=='、' || c=='｜' || c=='＝' || c=='=' || c=='＋' || c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉')
		{
			return true;
		}
	}

	return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
function findCode(mobile,code)//判断号码是否带有国家码，如果有，则去掉国家码后判断是否为合法的号码，合法则返回true
{
    var substr1 = mobile.charAt(0);
            if(substr1 == '+')
            {
                var subcode = mobile.substring(code.length,mobile.length);
                if(subcode.length !=11)
                {
                    return false;
                }
                var subcode1 = subcode.charAt(0);
                var subcode2 = subcode.charAt(1);
                if(subcode1 == '1' && subcode2 == '3')
                {
                    return true;
                }else
                {
                    return false;
                }

            }
            if(substr1 != '+')
            {
                if(mobile.length !=11)
                {
                    return false;
                }
                var subcode1 = mobile.charAt(0);
                var subcode2 = mobile.charAt(1);
                if(subcode1 == '1' && subcode2 == '3')
                {
                    return true;
                }else
                {
                    return false;
                }
            }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function containInvalidCharcust(field)//客服中的接收方号码过滤



{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if( c == '~' || c == '！' || c == '｜'
		   || c == '·' || c == '#' || c=='＋' || c=='◎' || c=='※'
		   || c == '￥' || c == '%'|| c == '……'|| c == '—'
		   || c == '*' || c == '（' || c == '）' || c == '——' || c == '|'
		   || c == '{' || c == '}' || c == '：' || c == '”' || c == '《' || c == '》'
		   || c == '？' || c == '`' || c == '!' || c == '@' || c == '＠' || c == '#' || c == '$'
		   || c == '％' || c == '^' || c == '&' || c == '*' || c == '(' || c == ')'
		   || c == '_' || c == '=' || c == '\\' || c == '[' || c == ']' || c == ';'
		   || c == '\''  || c == '\.' || c == '/' || c == '-' || c == '?'
           || c == '。' || c == '：' || c == '；' || c == '’' || c == '“' || c == '”' || c == '<'  || c == '>')
		{
			return true;
		}
	}

	return false;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
function checkFileName(field)//判断文件名称是否合法
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if( c == '~' || c == '！' || c == '｜'
		   || c == '·' || c == '#' || c=='＋' || c=='◎' || c=='※'
		   || c == '￥' || c == '%'|| c == '……'|| c == '—'
		   || c == '*' || c == '（' || c == '）' || c == '——' || c == '|'
		   || c == '{' || c == '}' || c == '：' || c == '”' || c == '《' || c == '》'
		   || c == '？' || c == '`' || c == '!' || c == '@' || c == '＠' || c == '#' || c == '$'
		   || c == '％' || c == '^' || c == '*'
		   || c == '=' || c == '\\' || c == ';'
		   || c == '\''  || c == '/' || c == '?' || c == '\"'
           || c == '。' || c == '：' || c == '；' || c == '’' || c == '“' || c == '”' || c == '<'  || c == '>')
		{
			return true;
		}
	}

	return false;
}
///////////////////////////////////////////////////////////////////////////////////////////
function containInvalidChartwo1(field)//是否是特殊符号（文本）



{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c==' '||c=='◎' || c=='※' || c=='\u00B7' || c=='!'||c=='+'||c=='-'||c==','|| c=='('||c==')'||c=='，'||c=='。'||c=='='||c=='…'|| c=='￥' || c=='＊' || c=='｜' || c=='｝'
		|| c=='｛' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆'
		|| c=='＊' || c=='｜' || c=='｝' || c=='｛' || c=='＞' || c=='＜' || c=='~'
		|| c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='|'
		|| c=='}' || c=='{' || c=='>' || c=='<' || c=='~' || c=='#' || c=='￥' || c=='%'
		|| c=='*'|| c=='|' || c=='}' || c=='{' || c=='\'' || c=='~' || c=='@' || c=='#'
		|| c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='|' || c=='}' || c=='{'
		|| c=='>' || c=='<' || c=='`' || c=='\\' || c==']' || c=='[' || c=='\'' || c=='/'
		|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='\\' || c=='＼' || c=='｜' || c=='＝' || c=='=' || c=='＝'
		|| c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉' || c=='`' || c=='[' || c==']')
		{
			return true;
		}
	}

	return false;
}
///////////////////////////////////////////////////////////////////////////////////////////
function containInvalidChartwo2(field)//是否是特殊符号（文本）



{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c=='◎' || c=='※' || c=='\u00B7' || c=='!'||c=='+'||c=='-'||c==','||c=='.' ||c=='('||c==')'||c=='，'||c=='。'||c=='…'|| c=='￥'
		|| c=='｛' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆'
		|| c=='＊' || c=='｜' || c=='｝' || c=='｛' || c=='＞' || c=='＜' || c=='~'
		|| c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*'
		|| c=='}' || c=='{' || c=='>' || c=='<' || c=='~' || c=='#' || c=='￥' || c=='%'
		|| c=='*' || c=='}' || c=='{' || c=='\'' || c=='~' || c=='@' || c=='#'
		|| c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='}' || c=='{'
		|| c=='>' || c=='<' || c=='`' || c=='\\' || c==']' || c=='[' || c=='\'' || c=='/'
		|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='\\' || c=='＼' || c=='＝' || c=='='
		|| c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉' || c=='`' || c=='[' || c==']')
		{
			return true;
		}
	}

	return false;
}
//////////////////////////////////////////////////////////////
function containInvalidChartwo(field)//是否是特殊符号（文本）



{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c==' '|| c=='◎' || c=='※' || c=='\u00B7' || c=='!'|| c=='￥' || c=='＊' || c=='｜' || c=='｝'
		|| c=='｛' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆'
		|| c=='＊' || c=='｜' || c=='｝' || c=='｛' || c=='＞' || c=='＜' || c=='~'
		|| c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='|'
		|| c=='}' || c=='{' || c=='>' || c=='<' || c=='~' || c=='#' || c=='￥' || c=='%'
		|| c=='*'|| c=='|' || c=='}' || c=='{' || c=='\'' || c=='~' || c=='@' || c=='#'
		|| c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='|' || c=='}' || c=='{'
		|| c=='>' || c=='<' || c=='`' || c=='\\' || c==']' || c=='[' || c=='\''
		|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='\\' || c=='＼' || c=='｜' || c=='＝' || c=='=' || c=='＝'
		|| c=='［' || c=='］' ||  c=='〈' || c=='〉' || c=='`' || c=='[' || c==']')
		{
			return true;
		}
	}

	return false;
}

function containInvalidChartwos(field)//创建动态群组中的群组描述JS是否是特殊符号（文本）



{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c=='◎' || c=='※' || c=='＃' || c=='￥' || c=='＊' || c=='｜' || c=='｝' || c=='\u00B7'
		|| c=='｛' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆' || c=='-'
		|| c=='＊' || c=='｜' || c=='｝' || c=='｛' || c=='＞' || c=='＜' || c=='~' || c=='－'
		|| c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='|' || c=='》'
		|| c=='}' || c=='{' || c=='>' || c=='<' || c=='~' || c=='#' || c=='￥' || c=='%' || c=='《'
		|| c=='*'|| c=='|' || c=='}' || c=='{' ||c=='~' || c=='@' || c=='#'
		|| c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='|' || c=='}' || c=='{'
		|| c=='>' || c=='<' || c=='\\' || c==']' || c=='[' || c=='/'
		|| c=='\\' || c=='＼' || c=='｜' || c=='＝' || c=='=' || c=='＝'
		|| c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉' || c=='[' || c==']')
		{
			return true;
		}
	}

	return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////

function isPhoneNumber(field)
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if((!isDigit(c))&&c!='-')
		{
			return false;
		}
	}

	return true;

}

/////////////////////////////////////////////////////////////////////////////////////////////

function converturlcode(field)
{
	field = field.replace('%','%25')
	field = field.replace('&','%26')
	field = field.replace('"','&quot;')
	field = field.replace('>','&gt;')
	field = field.replace('<','&lt;')
	field = field.replace('#','%23')
	field = field.replace('+','%2B')

	return field;
}

///////////////////////////////////////////////////////////////////////////////////////////////




function dropit2(name)
{
	var zindex=100
	var sOpen=""
	var nMenuNum = name.substring(name.length - 1,name.length)

	sOpen="dropmenu" + nMenuNum

	var themenu=document.all[sOpen]

	if (themenu == null)
	{
		return
	}

	if (document.all)
	{
		themenu.style.left=document.body.scrollLeft+event.clientX-event.offsetX
		themenu.style.top=document.body.scrollTop+event.clientY-event.offsetY+25

		if (themenu.style.visibility=="hidden")
		{
			 themenu.style.visibility="visible"
			 themenu.style.zIndex=zindex++
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////

function hidemenu(name)//屏蔽网页右件菜单
{
	var zindex=100
	var sOpen=""
	var nMenuNum = name.substring(name.length - 1,name.length)
	sOpen="dropmenu" + nMenuNum
	var themenu=document.all[sOpen]

	if (themenu == null)
	{
		return;
	}

	var theID = window.event.toElement.id.substring(0,1)

	if(window.event.toElement.id!=sOpen && window.event.toElement.id!="link" )
	{
		themenu.style.visibility="hidden";
	}
}



////////////////////////////////////////////////////////////////////////////////////////////////

function decomposeString(str, sperate1, sperate2)
{
	var returnArray = new Array();
	var tempArray = str.split(sperate1);
	var p = 0;

	for(i = 0; i < tempArray.length; i++)
	{
		var andArray = tempArray[i].split(sperate2);

		for(j = 0; j < andArray.length; j++)
		{
			if(andArray[j] != '' && andArray[j] != null)
			{
				returnArray[p++] = andArray[j];
			}
		}
	}

	return returnArray;
}


var new_window


function window_available()
{
	if(! new_window)
	{
		return false;
	}
	else if(new_window.closed)
	{
		return false;
	}
	else
	{
		return true;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////

function play(url , toneName , backgroundmap)
{

	if(!window_available())
	{

		new_window = window.open('/auditionpage.htm' ,"", "width=200 , height=200");
		//new_window.close();
	}
	else
	{
		new_window.close();
		new_window = window.open('/auditionpage.htm' ,"", "width=0 , height=0");
	}



	new_window.MediaPlayer.FileName = url;
	//new_window.MediaPlayer.Play();

}

//////////////////////////////////////////////////////////////////////////////////////////////////

function validatetime(dateString)//是否是时间



{

	if(dateString.length!=8)
	{
		return false;
	}

	if(isNumbers(dateString.substring(0,2))==false
	   ||isNumbers(dateString.substring(3,5))==false
	   ||isNumbers(dateString.substring(6,8))==false)
	{
		return false;
	}

	if(dateString.charAt(2)!=':'||dateString.charAt(5)!=':')
	{
		return false;
	}

	var hour=parseInt(dateString.substring(0,2),10);
	var minute=parseInt(dateString.substring(3,5),10);
	var second=parseInt(dateString.substring(6,8),10);

	if(hour<24&&minute<60&&second<60)
	{
		return true;
	}
	else
	{
		return false;
	}

}
var deliverWindow;
function delivertone(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes)
{
    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime
			  + "&downTimes=" + downTimes;
    if(deliverWindow != null)
	{
		 deliverWindow.close();
	}
	deliverWindow=window.open("/user/userdelivertone.screen?"+param,"","width=420,height=320,top=100,left=100");
}
var downWindow;
function downtone(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes)
{
    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime
			  + "&downTimes=" + downTimes;
    if(downWindow != null)
	{
		 downWindow.close();
	}
	downWindow=window.open("/user/userdowntone.screen?"+param,"","width=420,height=300,top=100,left=100");
}

 var listenWindow;
function listen(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes)
{
	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime
			  + "&downTimes=" + downTimes;
	if(listenWindow != null)
	{
		 listenWindow.close();
	}
	var left = 20;//Math.floor( (screen.width - 400) / 2);
	var top = 20;//Math.floor( (screen.height - 300) / 2);
	var lisurl= "../user/listentone.screen?"+param;
	//alert(lisurl);
	listenWindow = window.open(lisurl,"","width=420,height=340,top="+top+",left="+left);
}


 var adminlistenWin
function adminlisten(toneType,tongPath, toneID, toneName)
{
	if(adminlistenWin != null)
	{
		 adminlistenWin.close();
	}
	var left = 20;//Math.floor( (screen.width - 400) / 2);
	var top = 20;//Math.floor( (screen.height - 300) / 2);
	var lisurl= encodeURI("listentone.screen?toneType="+toneType+"&tonePath="+tongPath+"&toneID="+toneID+"&toneName="+toneName);
	adminlistenWin = window.open(lisurl,"","width=400,height=300,top="+top+",left="+left);
}


 var splistenWin;
function splisten(toneType,tongPath, toneID, toneName)
{
	if(splistenWin != null)
	{
		 splistenWin.close();
	}
	var left = 20;//Math.floor( (screen.width - 400) / 2);
	var top = 20;//Math.floor( (screen.height - 300) / 2);
	var lisurl= encodeURI("../sp/listentone.screen?toneType="+toneType+"&tonePath="+tongPath+"&toneID="+toneID+"&toneName="+toneName);
	splistenWin = window.open(lisurl,"","width=400,height=300,top="+top+",left="+left);
}


 var corplistenWin;
function corplisten(toneType,tongPath, toneID, toneName)
{
	if(corplistenWin != null)
	{
		 corplistenWin.close();
	}
	var left = 20;//Math.floor( (screen.width - 400) / 2);
	var top = 20;//Math.floor( (screen.height - 300) / 2);
	corplistenWin = window.open("../corp/listentone.screen?toneType="+toneType+"&tonePath="+tongPath+"&toneID="+toneID+"&toneName="+toneName,"","width=400,height=300,top="+top+",left="+left);
}
function numberOnly() // onkeypress event
{
  var key = window.event.keyCode;
  if(( key > 47 && key < 58 ) || (key==8)|| (key==9)|| (key==13)|| (key==37)|| (key==38)
	|| (key==39)|| (key==40)|| (key==46) || ( key > 95 && key < 106 ))
	  window.event.returnValue = true;
  else {
	  window.event.returnValue = false;
  }
}
///////////////////////////////////////////////////////////////////////////////////////////////////

function trim(strValue)//去掉前后空格
{
	var iLTR, jRTL;
	var chr;


	for( iLTR = 0; iLTR < strValue.length; iLTR++ )
	{
		chr = strValue.charAt(iLTR) ;
		if( chr != " " ) break;
	}

	if( iLTR == strValue.length ) return "";


	for( jRTL = strValue.length - 1; jRTL >= 0; jRTL-- )
	{
		chr = strValue.charAt(jRTL);
		if( chr != " " ) break;
	}
	return strValue.substring(iLTR, jRTL + 1);
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function trimZero(strValue)//去掉0
{
	var iLTR;
	var chr;


	for( iLTR = 0; iLTR < strValue.length; iLTR++ )
	{
		chr = strValue.charAt(iLTR) ;
		if( chr != "0" ) break;
	}

	if( iLTR == strValue.length ) return "";

	return strValue.substring(iLTR, strValue.length);
}
/////////////////////////////////////////////////////////////////////////////////////////////

function existChinese(strValue)//过滤汉字
{
	var chrCode
	for(var iChar = 0; iChar < strValue.length; iChar++)
	{
		chrCode = strValue.charCodeAt(iChar);
		if(parseInt(chrCode) > 255)
		{
			return true;
		}
	}
	return false;
}

////////////////////////////////////////////////////////////////////////////////////////////////

function formatInputNumber(oElement, length, decimal)//格式化数字



{
	var oInput = oElement;
	var oInputValue = trim(oInput.value);
	var iLowcase = oInputValue.indexOf("e");
	var iUpcase = oInputValue.indexOf("E");

	if( oInputValue == "")
	{
		oInput.value = "";
		return true;
	}

	if (existChinese(oInputValue))
	{
		oInput.value = "";
		return true;
	}

	if((iLowcase != -1)||(iUpcase != -1))
	{

		return true;
	}


	var bOverflow = false;
	var partInteger = "";
	var countIntegerLength = 0;
	var partDecimal = "";
	var countDecimalLength = 0;

	var iPoint = oInputValue.indexOf(".");

	var allowIntegerLength = length - decimal - 1;
	var allowDecimalLength = decimal;


	if(iPoint == -1)
	{
		partInteger = oInputValue;
		partInteger = trimZero(partInteger);
		countIntegerLength = oInputValue.length;
	}
	else
	{
		partInteger = oInputValue.substring(0,iPoint);
		partInteger = trimZero(partInteger);
		countIntegerLength = partInteger.length;

		partDecimal = oInputValue.substring(iPoint + 1, iPoint + 1 + allowDecimalLength);
		countDecimalLength = partDecimal.length;
	}
	if (partInteger == "")
	{
		partInteger = "0";
	}


	if(countIntegerLength > allowIntegerLength)
	{
		partInteger = "0";
		bOverflow = true;
	}


	if(countDecimalLength < allowDecimalLength)
	{
		for (var iDecimal = 0; iDecimal < (allowDecimalLength - countDecimalLength); iDecimal++)
			partDecimal = partDecimal + "0";
	}


	if (partDecimal != "")
	{
		oInput.value = partInteger + "." + partDecimal;
	}
	else
	{
		oInput.value = partInteger
	}
	if (bOverflow) oInput.focus();
}
/////////////////////////////////////////////////////////////////////////////////////////////

function clearValue(obj){//清空一个值



	obj.value = "";
}


//验证时间是否合法
function checkTaskTime(startTime,endTime,intevel,timeType)
{
    var taskStartTime = startTime;
    var taskEndTime = endTime;
    var intevel = intevel;

    //取得开始时间中的天
    var startDay = formatData(taskStartTime.substring(8,10));
    //取得开始时间中的小时



    var startHour = formatData(taskStartTime.substring(11,13));
    //取得结束时间中的分钟
    var startMinute = formatData(taskStartTime.substring(14,16));

    //取得结束时间中的天



    var endDay = formatData(taskEndTime.substring(8,10));
    //取得结束时间中的小时
    var endHour = formatData(taskEndTime.substring(11,13));
    //取得结束时间中的分钟
    var endMinute = formatData(taskEndTime.substring(14,16));

    var startAndEndIntevel = (endHour - startHour) * 60 + (endMinute - startMinute);

    var inputIntevel = intevel * 60;

    if(taskStartTime >= taskEndTime || startHour >= endHour)
    {
        alert("任务结束时间必须大于任务开始时间.");
        return false;
    }
    if(timeType == "2")
    {
        if((endDay - startDay) < intevel)
        {
            alert("任务开始时间和结束时间的时间差不能小于任务循环时间间隔.");
            return false;
        }
        if(startAndEndIntevel < inputIntevel)
        {
            alert("任务开始时间和结束时间的时间差不能小于任务循环时间间隔.")
            return false;
        }
    }
    else if(timeType == "3")
    {
        if(startAndEndIntevel < inputIntevel)
        {
            alert("任务开始时间和结束时间的时间差不能小于任务循环时间间隔.")
            return false;
        }
    }
    return true;
}

function formatData(str)
{
    var data = "0";
    if(str.charAt(0) == "0")
    {
        data = str.substring(1,2);
    }
    else
    {
        data = str;
    }
    return data;
}





//暂时不对国家码进行验证



  function checkHandPhone (phoneNumber)
  {
  if(checkHandPhones(phoneNumber)!=0)
  {
     return checkHandPhones(phoneNumber);
  }
  else
  {
  //截取最后8位



      phoneNumber=phoneNumber.substring(phoneNumber.length-8,phoneNumber.length)
      if(isNumbers(phoneNumber))
      {
        return 0;
      }
      else
      {
        return 3;
      }
  }
}






//公用CHECKBOX全选函数





   function checkAll(e, itemName)
   {
     var aa = document.getElementsByName(itemName);
     for (var i=0; i<aa.length; i++)
     if(!aa[i].disabled) aa[i].checked = e.checked;
   }
   function checkItem(e, allName)
   {
     var all = document.getElementsByName(allName)[0];
     if(!e.checked) all.checked = false;
   else
   {
      var aa = document.getElementsByName(e.name);
      for (var i=0; i<aa.length; i++)
      if(!aa[i].checked) return;
      all.checked = true;
    }
  }

//函数使用说明
//AlertMessage是弹出的消息，



//MobilNumber是需要验证的电话号码，



//CheckRule校验规则。



//可以用于号码段验证



function checkMobilNumber(AlertMessage,MobilNumber,CheckRule)
{
    var insertValue=MobilNumber.value;
    if(insertValue.search(CheckRule)==-1)
    {
        alert(AlertMessage);
        return false;
    }
    return true;
}
//批量验证号码适合于使用","分割的号码



function checkMobilNumbers(AlertMessage,MobilNumber,CheckRule)
{
    var MobilNumbers=MobilNumber.value;
    var MobilNumberArr=MobilNumbers.split(",");
    var insertValue;
    for(i=0;i<MobilNumberArr.length;i++)
    {
        insertValue=MobilNumberArr[i];
        if(insertValue!="")
        {
            if(insertValue.search(CheckRule)==-1)
            {
                alert(AlertMessage);
                return false;
            }
        }
    }
    return true;
}

//校验是否是数字



function isNumber(field)//是否是数字



{
    var f=trim(field.value);
    var pattern=/^[1-9][0-9]*$/;
		if (f.search(pattern)==-1 )
		{
			return false;
		}
	return true;
}

//校验是否是数字



//add by wangyong 2004-04-29
function isVipNumber(field)//是否是数字



{
    var f=trim(field.value);
    var pattern=/^[0-9][0-9]*$/;
	if (f.search(pattern)==-1 )
	{
		return false;
	}
	return true;
}

//校验是否是数字字符串
function isNumberStr(field)
{
    var f=trim(field.value);
    var pattern=/^[0-9]+$/;
		if (f.search(pattern)==-1 )
		{
			return false;
		}
	return true;
}
//校验是否是时间格式



function isTime()
{

}

function checkName(name)
{

	 if(name.indexOf('%',0)!=-1 || name.indexOf("'")!=-1 ||  name.indexOf("_")!=-1)
      {
          //alert("对不起.名称中禁止输入非法字符.");
          return false;
      }
	 return true;
}


/*start add by qinzhao 检查操作员姓名，操作员姓名可用包含空格，下划线*/
function checkOperatorName(field)//是否是特殊符号(全)
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if(c=='◎' || c=='※' || c=='～' || c=='！' || c=='·' || c=='＃' || c=='￥' || c=='＊' || c=='……' || c=='—' || c=='（' || c=='）' || c=='＋' || c=='｜' || c=='｝' || c=='｛'
|| c=='”' || c=='“'|| c=='：' || c=='？' || c=='》' || c=='《' || c=='～' || c=='！' || c=='＠' || c=='＃' || c=='＄' || c=='％' || c=='＾' || c=='＆' || c=='＊' || c=='（' || c=='）'
|| c=='＋' || c=='｜' || c=='｝' || c=='｛' || c=='＂' || c=='：' || c=='？' || c=='＞' || c=='＜' || c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&'
|| c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='}' || c=='{' || c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='~' || c=='！' || c=='·' || c=='#' || c=='；' || c=='-' || c=='－' || c=='－' || c=='-' || c=='；'
|| c=='￥' || c=='%' || c=='……' || c=='—' || c=='*' || c=='（' || c=='）' || c=='+' || c=='|' || c=='}' || c=='{' || c=='“' || c=='：' || c=='？' || c=='》' || c=='《' || c=='‘' || c=='＇' || c=='\'' || c=='’' || c=='，' || c==',' || c=='，' || c=='，'
|| c=='~' || c=='!' || c=='@' || c=='#' || c=='$' || c=='%' || c=='^' || c=='&' || c=='*' || c=='(' || c==')' || c=='+' || c=='|' || c=='？' || c=='}' || c=='{' || c==';' || c=='；' || c=='；' || c=='；'
|| c=='"' || c==':' || c=='?' || c=='>' || c=='<' || c=='`' || c=='-' || c=='=' || c=='\\' || c==']' || c=='[' || c=='\'' || c==';' || c=='/' || c=='.' || c==',' || c=='”' || c=='＂' || c=='…' || c=='。' || c=='.' || c=='．' || c=='。'
|| c=='`' || c=='｀' || c=='｀' || c=='`' || c=='、' || c=='\\' || c=='＼' || c=='、' || c=='｜' || c=='＝' || c=='=' || c=='＋' || c=='［' || c=='］' || c=='／' || c=='〈' || c=='〉')
		{
			return true;
		}
	}

	return false;
}
/*end add by qinzhao 检查操作员姓名，操作员姓名可用包含空格，下划线*/


///////////////////////////校验结束End By Simon///////////////////////////////

</SCRIPT>

<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_showHideLayers()
{ //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
		if ((obj=MM_findObj(args[i]))!=null)
		{
			v=args[i+2];
			if (obj.style)
			{
				obj=obj.style;
				v=(v=='show')?'visible':(v=='hide')?'hidden':v;
			}

			//insert my code
			if (v=='visible')
			{
				//alert("try to hide all layer1 and layer2");
				MM_hideAllLayers();
			}

			obj.visibility=v;
		}
  }

}

function MM_hideAllLayers()
{
	MM_findObj('Layer1').visibility='hidden';
	MM_findObj('Layer2').visibility='hidden';
}

function MM_showAllLayers()
{
	MM_findObj('Layer1').visibility='visible';
	MM_findObj('Layer2').visibility='visible';
}

var jumpPage = 0;
var checkedFolderCount = 0;
var checkedContentCount = 0;
var hiddenValues = 0;
function modifyMms(){
  if(checkSelect())
        {
            if(checkRename())
            {
                if(checkedContentCount == 1)
                {
                  if(FORM.chkContentID.checked)
                    {
	                    var folder = FORM.chkContentID.value;
	                    FORM.action="/mktweb/viewmms.do?mmsID=" + folder + "&folderID=" + hiddenValues;
	                    FORM.submit();
	                    return true;
                    }
                   else{
                        for( i = 0 ; i < FORM.chkContentID.length ; i++)
                          {
                              if(FORM.chkContentID[i].checked)
                                 {
                                    var folder = FORM.chkContentID[i].value;
				                    FORM.action="/mktweb/viewmms.do?mmsID=" + folder + "&folderID=" + hiddenValues;
				                    FORM.submit();
				                    return true;
                                 }


                          }
                   }
                }
                else if(checkedFolderCount == 1)
                {
                    var folder = FORM.chkfolderID[0].value;
                    FORM.action="/mktweb/viewmms.do?mmsID=" + folder + "&folderID=" + hiddenValues;
                    FORM.submit();
                }
            }
            else
            {
                checkedFolderCount = 0;

                checkedContentCount = 0;

                alert("请正确选择需要修改的对象.");

                return false;
            }
        }
        else
        {
            alert("请选择需要修改的对象.");

            return false;
        }
}

function dohidden(vals){

hiddenValues = vals;

}

function submitForm(str1)
{
    if(str1=="setshare")
    {
        if (true){
            FORM.action="/mktweb/foldershareinfo.do";
           }
        else{
	        alert("本库已共享！");
	        return false;
        }
    }
    else if(str1=="cancelsharefolder")
    {
        FORM.action="/mktweb/cancelshare.do";
    }
    else if(str1=="importcontent")
    {
        FORM.action="/mktweb/importcontent.do";
    }
    else if(str1=="uploadcontent")
    {
        FORM.action="/mktweb/uploadcontent.do";
    }

    else if(str1=="delete")
    {
        if(checkSelect())
        {
            if(confirm("本操作不可恢复,是否继续?"))
            {
                FORM.action="/mktweb/deletecontent.do";
            }
            else
            {
                return false;
            }
        }
        else
        {
            alert("请选择需要删除的记录.");

            return false;
        }
    }

    else if(str1=="updatefolder")
    {
        FORM.action="/mktweb/root/market/contentmanage/updatefolder.jsp?folderID=3&folderName=短信库";
    }
    else if(str1=="edit")
    {
        if(checkSelect())
        {
            if(checkRename())
            {
                if(checkedContentCount == 1)
                {
                    FORM.action="/mktweb/loadcontent.do";
                }
                else if(checkedFolderCount == 1)
                {
                    FORM.action="/mktweb/loadfolder.do?modifyFolderID=";
                }
            }
            else
            {
                checkedFolderCount = 0;

                checkedContentCount = 0;

                alert("请正确选择需要修改的对象.");

                return false;
            }
        }
        else
        {
            alert("请选择需要修改的对象.");

            return false;
        }
    }
    else if(str1=="createmms")
    {
        FORM.action="/mktweb/createnewmms.do?folderID=3";
    }

    else if(str1=="uppage")
    {
        FORM.action="/mktweb/root/market/contentmanage/foldercontentimage.jsp?pageNumber=-1";
    }
    else if(str1=="nextpage")
    {
        FORM.action="/mktweb/root/market/contentmanage/foldercontentimage.jsp?pageNumber=1";
    }
    else if(str1=="firstpage")
    {
        FORM.action="/mktweb/root/market/contentmanage/foldercontentimage.jsp?pageNumber=0";
    }
    else if(str1=="lastpage")
    {
        FORM.action="/mktweb/root/market/contentmanage/foldercontentimage.jsp?pageNumber=2";
    }
    else if(str1=="jumpPage")
    {
        FORM.action="/mktweb/root/market/contentmanage/foldercontentimage.jsp?pageNumber="+jumpPage;
    }
    else if(str1=="keyJump" && event.keyCode=='13')
    {
        FORM.action="/mktweb/root/market/contentmanage/foldercontentimage.jsp?pageNumber="+jumpPage;
    }
    else if(str1=="keyJump" && event.keycode!='13')
    {
        return false;
    }
    else if(str1=="jumpNum")
    {
        if(FORM.pageNumber.value > 0 && FORM.pageNumber.value <= 3)
        {
            jumpPage = FORM.pageNumber.value - 1;
        }
        else if(FORM.pageNumber.value > 3)
        {
            jumpPage = 2;
        }
        else
        {
            jumpPage = 0;
        }
        return;
    }
    FORM.submit();
}

function checkSelect()
{
    if(true && 0 >= 1)
    {
        if(FORM.chkfolderID != null)
        {
            if(FORM.chkfolderID.checked)
            {
                return true;
            }
        }
        if(FORM.chkContentID != null)
        {
            if(FORM.chkContentID.checked)
            {
                return true;
            }
        }
    }
    if(true && 14 >= 1)
    {
        if(FORM.chkContentID != null)
        {
            if(FORM.chkContentID.checked)
            {
                return true;
            }
        }
    }
    if(FORM.chkContentID != null)
    {
        for(i = 0;i < FORM.chkContentID.length;i++)
        {
            if(FORM.chkContentID[i].checked)
            {
                return true;
            }
        }
    }
    if(FORM.chkfolderID != null)
    {
        for(i = 0;i < FORM.chkfolderID.length;i++)
        {
            if(FORM.chkfolderID[i].checked)
            {
                return true;
            }
        }
    }
    return false;
}

function checkRename()
{
    checkedCount = 0;

    if(FORM.chkfolderID != null)
    {
        for(i = 0;i < FORM.chkfolderID.length;i++)
        {
            if(FORM.chkfolderID[i].checked)
            {
                checkedCount ++;
                checkedFolderCount ++;
            }
        }
        if(checkedCount > 1)
        {
            return false;
        }
    }
    if(FORM.chkfolderID != null)
    {
        if(FORM.chkfolderID.checked)
        {
            checkedCount++;
            checkedFolderCount ++;
        }
    }
    if(FORM.chkContentID != null)
    {
        for(i = 0;i < FORM.chkContentID.length;i++)
        {
            if(FORM.chkContentID[i].checked)
            {
                checkedCount ++;
                checkedContentCount ++;
            }
        }
        if(checkedCount > 1)
        {
            return false;
        }
    }
    if(FORM.chkContentID != null)
    {
        if(FORM.chkContentID.checked)
        {
            checkedCount++;
            checkedContentCount ++;
        }
    }
    if(checkedFolderCount > 1 || checkedContentCount > 1)
    {
        return false;
    }
    if(checkedFolderCount > 0 && checkedContentCount > 0)
    {
        return false;
    }
    return true;
}

function selectFC()
{
  
    if(FORM.chkContentID != null)
    {
        for(i = 0;i < FORM.chkContentID.length;i++)
        {
            if(!FORM.chkContentID[i].checked)
            {
                FORM.selectAll.checked=false;
                return;
            }
        }
    }
    
    
    
    
    FORM.selectAll.checked=true;
}
function selectAll(){

  var a=document.getElementsByName("chkfolderID");
  for(var i=0;i<a.length;i++){
        a[i].checked = true;
  }
   var b=document.getElementsByName("chkContentID");
  for(var i=0;i<b.length;i++){
        b[i].checked = true;
  }
}
function checkAll1(e, itemName)
   {
     var aa = document.getElementsByName(itemName);
     for (var i=0; i<aa.length; i++)
     if(!aa[i].disabled) aa[i].checked = e.checked;
   }